{include file="common/_meta" /}
<title>添加管理员 - 管理员管理 - H-ui.admin v3.1</title>
<meta name="keywords" content="李志立，lizhilimaster@163.com">
<meta name="description" content="李志立，lizhilimaster@163.com">
</head>
<body>
<div class="page-container">
	<form action="" method="post" enctype="multipart/form-data" class="form form-horizontal" id="form-category-add">
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">
				<span class="c-red">*</span>
				上级栏目：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
				<select class="select" id="fid" name="fid">
					<option value="0">顶级分类</option>
					{volist name="datasort" id="vo"}
					<option value="{$vo.id}"><?php echo str_repeat("|--",$vo['level']);?>{$vo.catename}</option>
					{/volist}
				</select>
				</span>
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">
				<span class="c-red">*</span>
				栏目名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" onKeyUp="zhuan()" placeholder="" id="catename" name="catename">
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">
				<span class="c-red">*</span>
				英文名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="en_name" name="en_name">
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">图标：</label>
			<div class="formControls col-xs-9 col-sm-9">
				<div class="uploader-thum-container">
					<a href="javascript:void();" class="btn btn-primary radius"><i class="icon Hui-iconfont">&#xe642;</i> 浏览文件</a>
					<input type="file" class="input-file" onchange='onpic()' name="pic" id="pic" value="" accept='image/*' style="font-size: 20px;left:0;" /><span
						id="sp"></span>
				</div>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">跳转设置：</label>
			<div class="formControls col-xs-3 col-sm-3">
				<span class="select-box">
				<select name="tiao_type" class="select">
					<option value="0">不跳转</option>
					<option value="1">跳转栏目页</option>
					<option value="2">跳转详情页</option>
				</select>
				</span>
			</div>
			<label class="form-label col-xs-3 col-sm-2">跳转设置：</label>
			<div class="col-xs-3 col-sm-4">
				<input type="number" class="input-text" value="" placeholder="请填写跳转id"  name="tiao_id" style="width: 100%;">
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">栏目类型：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
				<select name="type" id="type1" class="select">
					<option value="1">文章列表</option>
					<option value="2">单页</option>
					<option value="3">图片列表</option>
					<option value="4">远程链接</option>
				</select>
				</span>
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl"  id="catehtml">
			<label class="form-label col-xs-3 col-sm-2">
				栏目模版：</label>
			<div class="formControls col-xs-3 col-sm-4">
				<span class="select-box">
				<select name="catehtml" class="select">
					<option value>默认模版</option>
					{volist name="html" id="vo"}
					<option value="{$vo.name}">{$vo.name}</option>
					{/volist}
				</select>
				</span>
			</div>
			<div class="formControls col-xs-5 col-sm-5" style="color: #f37b1d">
				开启手机模版分离，模版全部加上 “ m_ ”（网站配置-系统设置）
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl"  id="showhtml">
			<label class="form-label col-xs-3 col-sm-2">
				详情模版：</label>
			<div class="formControls col-xs-3 col-sm-4">
				<span class="select-box">
				<select name="showhtml" class="select">
					<option value>默认模版</option>
					{volist name="html" id="vo"}
					<option value="{$vo.name}">{$vo.name}</option>
					{/volist}
				</select>
				</span>
			</div>
			<div class="formControls col-xs-5 col-sm-5" style="color: #f37b1d">
				开启手机模版分离，模版全部加上 “ m_ ”（网站配置-系统设置）
			</div>
			<div class="col-3">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">
				栏目关键字：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="" id="keyword" name="keyword">
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl"  id="lian" style="display: none;">
			<label class="form-label col-xs-3 col-sm-2">
				<span class="c-red">*</span>
				链接地址：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="" placeholder="请输入远程链接地址http:" id="url" name="url">
			</div>
			<div class="col-3">
			</div>
		</div>

		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">栏目描述：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="mark" id="mark" cols="" rows="" class="textarea"  placeholder="说点什么，请输入..." onKeyUp="textlength()"></textarea>
				<p class="textarea-numberbar"><em class="textarea-length">0</em>/200</p>
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl" id="yin" style="display: none;">
			<label class="form-label col-xs-3 col-sm-2">单页显示内容：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<script id="danye" type="text/plain" style="width:100%;height:400px;"></script>
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<div class="col-9 col-offset-2">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>

	</form>
</div>
{include file="common/_footer" /}
<style type="text/css">
	.li123 {
		line-height: 30px;
		background: burlywood;
		display: inline-block;
		vertical-align: middle;
		padding: 0 8px;
	}
	#abtn,.dtbtn{
		color: red;
	}
</style>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="__MANAGE__lib/ueditor/ueditor.config.js"></script> 
<script type="text/javascript" src="__MANAGE__lib/ueditor/ueditor.all.min.js"> </script> 
<script type="text/javascript" src="__MANAGE__lib/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="__MANAGE__lib/function.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	let wo=$("#form-category-add").validate({
		rules:{
			fid:{
				required:true,
			},
			catename:{
				required:true,
			},
			en_name:{
				required:true,
			},
			url: {
				required:true,
				url: true,
			},
		},
		submitHandler:function(form) {
			$("input[type=\"submit\"]").addClass('disabled').attr("disabled",true);
			var index = layer.load(1, {
				shade: [0.1,'#fff'] //0.1透明度的白色背景
			});
			setTimeout(()=>{
				$("input[type=\"submit\"]").removeClass('disabled').attr("disabled",false);
				layer.close(index);
			},1000)
			form.submit();
		}
	});

	$("#type1").change(function () {
		
		if (this.value== "2"){
			$('#yin').show();
			$('#lian').hide();
			$('#catehtml').show();
			$('#showhtml').hide();
			return false;
		}
		if (this.value== "4"){
			$('#yin').hide();
			$('#lian').show();
			$('#catehtml').hide();
			$('#showhtml').hide();
			return false;
		}
		$('#yin').hide();
		$('#lian').hide();
		$('#catehtml').show();
		$('#showhtml').show();
    })
	var ue = UE.getEditor('danye');
});
function textlength(){
	var nmb=$('#mark').val().length;
	$('.textarea-length').text(nmb);
	if(nmb>200){
		$('#mark').css("background-color","orangered");
		$('#mark').val($('#mark').val().substr(0,200));
		$('.textarea-length').text(200);
	}else{
		$('#mark').css("background-color","white");
		$('.textarea-length').text(nmb);
	}
}
function zhuan(){
	$('#en_name').val(getPinYinByName($('#catename').val()));    
}

function onpic() {
	var file = document.getElementById("pic").files[0];
	document.getElementById("sp").innerHTML = '您已经选择图片：' + file['name'];
	document.getElementById("sp").className = 'li123';
}

</script>
</body>
</html>